package cn.gson.work.model.pojos;

import javax.persistence.*;
import java.util.List;
import java.util.Objects;

@Entity
public class Dossier {
    private long rsno;
    private String rsid;
    private String rsname;
    private String rstate;
    private Volumelibrary volumelibrary;
    private List<Tfiles> tfiles;

    @Id
    @Column(name = "rsno")
    public long getRsno() {
        return rsno;
    }

    public void setRsno(long rsno) {
        this.rsno = rsno;
    }

    @Basic
    @Column(name = "RSID")
    public String getRsid() {
        return rsid;
    }

    public void setRsid(String rsid) {
        this.rsid = rsid;
    }

    @Basic
    @Column(name = "RSNAME")
    public String getRsname() {
        return rsname;
    }

    public void setRsname(String rsname) {
        this.rsname = rsname;
    }

    @Basic
    @Column(name = "RSTATE")
    public String getRstate() {
        return rstate;
    }

    public void setRstate(String rstate) {
        this.rstate = rstate;
    }

    @ManyToOne
    @JoinColumn(name="VLNO")
    public Volumelibrary getVolumelibrary() {
        return volumelibrary;
    }

    public void setVolumelibrary(Volumelibrary volumelibrary) {
        this.volumelibrary = volumelibrary;
    }

    @OneToMany(mappedBy="dossier")
    public List<Tfiles> getTfiles() {
        return tfiles;
    }

    public void setTfiles(List<Tfiles> tfiles) {
        this.tfiles = tfiles;
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Dossier dossier = (Dossier) o;
        return rsno == dossier.rsno &&
                Objects.equals(rsid, dossier.rsid) &&
                Objects.equals(rsname, dossier.rsname) &&
                Objects.equals(rstate, dossier.rstate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(rsno, rsid, rsname, rstate);
    }

    @Override
    public String toString() {
        return "Dossier{" +
                "rsno=" + rsno +
                ", rsid='" + rsid + '\'' +
                ", rsname='" + rsname + '\'' +
                ", rstate='" + rstate + '\'' +
                ", volumelibrary=" + volumelibrary +
                ", tfiles=" + tfiles +
                '}';
    }
}
